using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

namespace Portal.Data.Webparts
{
    public class WebpartMenu : WebControl
    {
        #region data

        public string CSSClass;
        private readonly ArrayList _items = new ArrayList();

        #endregion

        #region render    
        /// <summary>
        /// 
        /// </summary>
        /// <param name="writer"></param>
        protected override void Render(HtmlTextWriter writer)
        {
            //write begin tags

            string id = UniqueID;

            writer.Write("<span id='" + id + "' class=\"" + CSSClass + "\">");

            foreach (MenuItem item in _items)
            {
                writer.Write("<span class='" + item.CSSClass + "' onmousedown='event.cancelBubble=true;'><a href='" + item.Link + "'>" + item.Name + "</a></span>");
            }

            writer.Write("</span>");
        }

        #endregion

        #region methods

        public void Add(MenuItem item)
        {
            _items.Add(item);
        }

        #endregion
    }	
}
